home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / prog / atari / c / ck5a189s / ckcdeb.h < prev    next >
C/C++ Source or Header  |  1993-07-01  |  36KB  |  1,473 lines

  1. /*  C K C D E B . H  */
  2.  
  3. /*
  4.   This file is included by all C-Kermit modules, including the modules
  5.   that aren't specific to Kermit (like the command parser and the ck?tio and
  6.   ck?fio modules).  It specifies format codes for debug(), tlog(), and similar
  7.   functions, and includes any necessary definitions to be used by all C-Kermit
  8.   modules, and also includes some feature selection compile-time switches, and
  9.   also system- or compiler-dependent definitions, plus #includes and prototypes
  10.   required by all C-Kermit modules.
  11. */
  12.  
  13. /*
  14.   Author: Frank da Cruz (fdc@columbia.edu, FDCCU@CUVMA.BITNET),
  15.   Columbia University Academic Information Systems, New York City.
  16.  
  17.   Copyright (C) 1985, 1993, Trustees of Columbia University in the City of New
  18.   York.  The C-Kermit software may not be, in whole or in part, licensed or
  19.   sold for profit as a software product itself, nor may it be included in or
  20.   distributed with commercial products or otherwise distributed by commercial
  21.   concerns to their clients or customers without written permission of the
  22.   Office of Kermit Development and Distribution, Columbia University.  This
  23.   copyright notice must not be removed, altered, or obscured.
  24. */
  25.  
  26. /*
  27.   Etymology: The name of this file means "C-Kermit Common-C-Language Debugging
  28.   Header", because originally it contained only the formats (F000-F111) for
  29.   the debug() and tlog() functions.  See how it has grown...
  30. */
  31.  
  32. #ifndef CKCDEB_H            /* Don't include me more than once. */
  33. #define CKCDEB_H
  34.  
  35. #ifndef DEFPAR                /* Default parity */
  36. #define DEFPAR 0            /* Must be here because it is used */
  37. #endif /* DEFPAR */            /* by all classes of modules */
  38.  
  39. #ifdef OS2                /* For OS/2 debugging */
  40. #include "ckoker.h"
  41. #endif /* OS2 */
  42.  
  43. #include <stdio.h>            /* Begin by including this. */
  44. #include <ctype.h>            /* and this. */
  45.  
  46. #ifdef MAC
  47. /*
  48.  * The MAC doesn't use standard stdio routines.
  49.  */
  50. #undef getchar
  51. #undef putchar
  52. #endif /* MAC */
  53.  
  54. /* System-type compilation switches */
  55.  
  56. #ifdef FT21                /* Fortune For:Pro 2.1 implies 1.8 */
  57. #ifndef FT18
  58. #define FT18
  59. #endif /* FT18 */
  60. #endif /* FT21 */
  61.  
  62. #ifdef AIXPS2                /* AIXPS2 implies AIX370 */
  63. #ifndef AIX370
  64. #define AIX370
  65. #endif /* AIX370 */
  66. #endif /* AIXPS2 */
  67.  
  68. #ifdef AIX370                /* AIX PS/2 or 370 implies BSD4 */
  69. #ifndef BSD4
  70. #define BSD4
  71. #endif /* BSD4 */
  72. #endif /* AIX370 */
  73.  
  74. #ifdef AIXESA                /* AIX/ESA implies BSD4.4 */
  75. #ifndef BSD44
  76. #define BSD44
  77. #endif /* BSD44 */
  78. #endif /* AIXESA */
  79.  
  80. #ifdef DGUX540                /* DG UX 5.40 implies Sys V R 4 */
  81. #ifndef SVR4
  82. #define SVR4
  83. #endif /* SVR4 */
  84. #endif /* DGUX540 */
  85.  
  86. #ifdef SUNOS41                /* SUNOS41 implies SUNOS4 */
  87. #ifndef SUNOS4
  88. #define SUNOS4
  89. #endif /* SUNOS4 */
  90. #endif /* SUNOS41 */
  91.  
  92. #ifdef SUN4S5                /* Sun-4 System V environment */
  93. #ifndef SVR3                /* implies System V R3 or later */
  94. #define SVR3
  95. #endif /* SVR3 */
  96. #endif /* SUN4S5 */
  97.  
  98. #ifdef MIPS                /* MIPS System V environment */
  99. #ifndef SVR3                /* implies System V R3 or later */
  100. #define SVR3
  101. #endif /* SVR3 */
  102. #endif /* MIPS */
  103.  
  104. /*
  105.   4.4BSD is a mixture of System V R4, POSIX, and 4.3BSD.
  106. */
  107. #ifdef BSD44                /* 4.4 BSD */
  108. #ifndef SVR4                /* BSD44 implies SVR4 */
  109. #define SVR4
  110. #endif /* SVR4 */
  111. #ifndef NOSETBUF            /* NOSETBUF is safe */
  112. #define NOSETBUF
  113. #endif /* NOSETBUF */
  114. #ifndef DIRENT                /* Uses <dirent.h> */
  115. #define DIRENT
  116. #endif /* DIRENT */
  117. #endif /* BSD44 */
  118.  
  119. #ifdef SVR3                /* SVR3 implies ATTSV */
  120. #ifndef ATTSV
  121. #define ATTSV
  122. #endif /* ATTSV */
  123. #endif /* SVR3 */
  124.  
  125. #ifdef SVR4                /* SVR4 implies ATTSV */
  126. #ifndef ATTSV
  127. #define ATTSV
  128. #endif /* ATTSV */
  129. #ifndef SVR3                /* ...as well as SVR3 */
  130. #define SVR3
  131. #endif /* SVR3 */
  132. #endif /* SVR4 */
  133.  
  134. #ifdef OXOS
  135. #ifndef ATTSV
  136. #define ATTSV                /* OXOS implies ATTSV */
  137. #endif /* ! ATTSV */
  138. #define SW_ACC_ID            /* access() wants privs on */
  139. #define kill priv_kill            /* kill() wants privs on */
  140. #ifndef NOSETBUF
  141. #define NOSETBUF            /* NOSETBUF is safe */
  142. #endif /* ! NOSETBUF */
  143. #endif /* OXOS */
  144.  
  145. #ifdef UTSV                /* UTSV implies ATTSV */
  146. #ifndef ATTSV
  147. #define ATTSV
  148. #endif /* ATTSV */
  149. #endif /* UTSV */
  150.  
  151. #ifdef XENIX                /* XENIX implies ATTSV */
  152. #ifndef ATTSV
  153. #define ATTSV
  154. #endif /* ATTSV */
  155. #endif /* XENIX */
  156.  
  157. #ifdef AUX                /* AUX implies ATTSV */
  158. #ifndef ATTSV
  159. #define ATTSV
  160. #endif /* ATTSV */
  161. #endif /* AUX */
  162.  
  163. #ifdef ATT7300                /* ATT7300 implies ATTSV */
  164. #ifndef ATTSV
  165. #define ATTSV
  166. #endif /* ATTSV */
  167. #endif /* ATT7300 */
  168.  
  169. #ifdef ATT6300                /* ATT6300 implies ATTSV */
  170. #ifndef ATTSV
  171. #define ATTSV
  172. #endif /* ATTSV */
  173. #endif /* ATT6300 */
  174.  
  175. #ifdef HPUX                /* HPUX implies ATTSV */
  176. #ifndef ATTSV
  177. #define ATTSV
  178. #endif /* ATTSV */
  179. #endif /* HPUX */
  180.  
  181. #ifdef ISIII                /* ISIII implies ATTSV */
  182. #ifndef ATTSV
  183. #define ATTSV
  184. #endif /* ATTSV */
  185. #endif /* ISIII */
  186.  
  187. #ifdef NEXT                /* NEXT implies BSD4 */
  188. #ifndef BSD4
  189. #define BSD4
  190. #endif /* BSD4 */
  191. #endif /* NEXT */
  192.  
  193. #ifdef SUNOS4                /* SUNOS4 implies BSD4 */
  194. #ifndef BSD4
  195. #define BSD4
  196. #endif /* BSD4 */
  197. #endif /* SUNOS4 */
  198.  
  199. #ifdef BSD41                /* BSD41 implies BSD4 */
  200. #ifndef BSD4
  201. #define BSD4
  202. #endif /* BSD4 */
  203. #endif /* BSD41 */
  204.  
  205. #ifdef BSD43                /* BSD43 implies BSD4 */
  206. #ifndef BSD4
  207. #define BSD4
  208. #endif /* BSD4 */
  209. #endif /* BSD43 */
  210.  
  211. #ifdef BSD4                /* BSD4 implies ANYBSD */
  212. #ifndef ANYBSD
  213. #define ANYBSD
  214. #endif /* ANYBSD */
  215. #endif /* BSD4 */
  216.  
  217. #ifdef BSD29                /* BSD29 implies ANYBSD */
  218. #ifndef ANYBSD
  219. #define ANYBSD
  220. #endif /* ANYBSD */
  221. #endif /* BSD29 */
  222.  
  223. #ifdef ATTSV                /* ATTSV implies UNIX */
  224. #ifndef UNIX
  225. #define UNIX
  226. #endif /* UNIX */
  227. #endif /* ATTSV */
  228.  
  229. #ifdef ANYBSD                /* ANYBSD implies UNIX */
  230. #ifndef UNIX
  231. #define UNIX
  232. #endif /* UNIX */
  233. #endif /* ANYBSD */
  234.  
  235. #ifdef POSIX                /* POSIX implies UNIX */
  236. #ifndef UNIX
  237. #define UNIX
  238. #endif /* UNIX */
  239. #ifndef DIRENT                /* and DIRENT, i.e. <dirent.h> */
  240. #ifndef SDIRENT
  241. #define DIRENT
  242. #endif /* SDIRENT */
  243. #endif /* DIRENT */
  244. #ifndef NOFILEH                /* POSIX doesn't use <sys/file.h> */
  245. #define NOFILEH
  246. #endif /* NOFILEH */
  247. #endif /* POSIX */
  248.  
  249. #ifdef V7
  250. #ifndef UNIX
  251. #define UNIX
  252. #endif /* UNIX */
  253. #endif /* V7 */
  254.  
  255. #ifdef COHERENT
  256. #ifndef UNIX
  257. #define UNIX
  258. #endif /* UNIX */
  259. #endif /* COHERENT */
  260.  
  261. #ifdef MINIX
  262. #ifndef UNIX
  263. #define UNIX
  264. #endif /* UNIX */
  265. #endif /* MINIX */
  266. /*
  267.   The symbol SVORPOSIX is defined for both AT&T and POSIX compilations
  268.   to make it easier to select items that System V and POSIX have in common,
  269.   but which BSD, V7, etc, do not have.
  270. */
  271. #ifdef ATTSV
  272. #ifndef SVORPOSIX
  273. #define SVORPOSIX
  274. #endif /* SVORPOSIX */
  275. #endif /* ATTSV */
  276.  
  277. #ifdef POSIX
  278. #ifndef SVORPOSIX
  279. #define SVORPOSIX
  280. #endif /* SVORPOSIX */
  281. #endif /* POSIX */
  282.  
  283. /*
  284.   The symbol SVR4ORPOSIX is defined for both AT&T System V R4 and POSIX 
  285.   compilations to make it easier to select items that System V R4 and POSIX 
  286.   have in common, but which BSD, V7, and System V R3 and earlier, etc, do
  287.   not have.
  288. */
  289. #ifdef POSIX
  290. #ifndef SVR4ORPOSIX
  291. #define SVR4ORPOSIX
  292. #endif /* SVR4ORPOSIX */
  293. #endif /* POSIX */
  294. #ifdef SVR4
  295. #ifndef SVR4ORPOSIX
  296. #define SVR4ORPOSIX
  297. #endif /* SVR4ORPOSIX */
  298. #endif /* SVR4 */
  299.  
  300. /*
  301.   The symbol BSD44ORPOSIX is defined for both 4.4BSD and POSIX compilations
  302.   to make it easier to select items that 4.4BSD and POSIX have in common,
  303.   but which System V, BSD, V7, etc, do not have.
  304. */
  305. #ifdef BSD44
  306. #ifndef BSD44ORPOSIX
  307. #define BSD44ORPOSIX
  308. #endif /* BSD44ORPOSIX */
  309. #endif /* BSD44 */
  310.  
  311. #ifdef POSIX
  312. #ifndef BSD44ORPOSIX
  313. #define BSD44ORPOSIX
  314. #endif /* BSD44ORPOSIX */
  315. #endif /* POSIX */
  316.  
  317. #ifdef __DECC                /* For DEC Alpha AXP VMS or OSF/1 */
  318. #ifdef __ALPHA
  319. #define CK_ANSIC            /* Even with /stand=vaxc, need ansi */
  320. #define SIG_V                /* and signal type is VOID */
  321. #endif    /* __ALPHA */
  322. #endif    /* __DECC */
  323.  
  324. #ifdef apollo                /* May be ANSI-C, check further */
  325. #ifdef __STDCPP__
  326. #define CK_ANSIC            /* Yes, this is real ANSI-C */
  327. #define SIG_V
  328. #else
  329. #define NOANSI                /* Nope, not ANSI */
  330. #undef __STDC__                /* Even though it say it is! */
  331. #define SIG_I
  332. #endif /* __STDCPP__ */
  333. #endif /* apollo */
  334.  
  335. #ifdef POSIX                /* -DPOSIX on cc command line */
  336. #ifndef _POSIX_SOURCE            /* Implies _POSIX_SOURCE */
  337. #define _POSIX_SOURCE
  338. #endif /* _POSIX_SOURCE */
  339. #endif /* POSIX */
  340.  
  341. /*
  342.   ANSI C?  That is, do we have function prototypes, new-style
  343.   function declarations, and parameter type checking and coercion?
  344. */
  345. #ifdef MAC                /* MPW C is ANSI */
  346. #ifndef NOANSI
  347. #ifndef CK_ANSIC
  348. #define CK_ANSIC
  349. #endif /* CK_ANSIC */
  350. #endif /* NOANSI */
  351. #endif /* MAC */
  352.  
  353. #ifndef NOANSI
  354. #ifdef __STDC__                /* __STDC__ means ANSI C */
  355. #ifndef CK_ANSIC
  356. #define CK_ANSIC
  357. #endif /* CK_ANSIC */
  358. #endif /* __STDC__ */
  359. #endif /* NOANSI */
  360. /*
  361.   _PROTOTYP() is used for forward declarations of functions so we can have
  362.   parameter and return value type checking if the compiler offers it.
  363.   __STDC__ should be defined by the compiler only if function prototypes are
  364.   allowed.  Otherwise, we get old-style forward declarations.  Our own private
  365.   CK_ANSIC symbol tells whether we use ANSI C prototypes.  To force use of
  366.   ANSI prototypes, include -DCK_ANSIC on the cc command line.  To disable the
  367.   use of ANSI prototypes, include -DNOANSI.
  368. */
  369. #ifdef CK_ANSIC
  370. #define _PROTOTYP( func, parms ) func parms
  371. #else /* Not ANSI C */
  372. #define _PROTOTYP( func, parms ) func()
  373. #endif /* CK_ANSIC */
  374.  
  375. /*
  376.   Altos-specific items: 486, 586, 986 models...
  377. */
  378. #ifdef A986
  379. #define M_VOID
  380. #define void int
  381. #define CHAR char
  382. #define SIG_I
  383. #endif /* A986 */
  384.  
  385. /* Void type */
  386.  
  387. #ifndef VOID                /* Used throughout all C-Kermit */
  388. #ifdef CK_ANSIC                /* modules... */
  389. #define VOID void
  390. #else
  391. #define VOID int
  392. #endif /* CK_ANSIC */
  393. #endif /* VOID */
  394.  
  395. /* Signal type */
  396.  
  397. #ifndef SIG_V                /* signal() type, if not def'd yet */
  398. #ifndef SIG_I
  399. #ifdef OS2
  400. #define SIG_V
  401. #else
  402. #ifdef POSIX
  403. #define SIG_V
  404. #else
  405. #ifdef SVR3                /* System V R3 and later */
  406. #define SIG_V
  407. #else
  408. #ifdef SUNOS4                /* SUNOS V 4.0 and later */
  409. #ifndef sun386
  410. #define SIG_V 
  411. #else
  412. #define SIG_I
  413. #endif /* sun386 */
  414. #else
  415. #ifdef NEXT                /* NeXT */
  416. #define SIG_V
  417. #else
  418. #ifdef AIX370
  419. #include <signal.h>
  420. #define SIG_V
  421. #define SIGTYP __SIGVOID        /* AIX370 */
  422. #else
  423. #define SIG_I
  424. #endif /* AIX370 */
  425. #endif /* NEXT */
  426. #endif /* SUNOS4 */
  427. #endif /* SVR3 */
  428. #endif /* POSIX */
  429. #endif /* OS2 */
  430. #endif /* SIG_I */
  431. #endif /* SIG_V */
  432.  
  433. #ifdef SIG_I
  434. #define SIGRETURN return(0)
  435. #ifndef SIGTYP
  436. #define SIGTYP int
  437. #endif /* SIGTYP */
  438. #endif /* SIG_I */
  439.  
  440. #ifdef SIG_V
  441. #define SIGRETURN return
  442. #ifndef SIGTYP
  443. #define SIGTYP void
  444. #endif /* SIGTYP */
  445. #endif /* SIG_V */
  446.  
  447. #ifndef SIGTYP
  448. #define SIGTYP int
  449. #endif /* SIGTYP */
  450.  
  451. #ifndef SIGRETURN
  452. #define SIGRETURN return(0)
  453. #endif /* SIGRETURN */
  454.  
  455. /* We want all characters to be unsigned if the compiler supports it */
  456.  
  457. #ifdef PROVX1
  458. typedef char CHAR;
  459. /* typedef long LONG; */
  460. typedef int void;
  461. #else
  462. #ifdef MINIX
  463. typedef unsigned char CHAR;
  464. #else
  465. #ifdef V7
  466. typedef char CHAR;
  467. #else
  468. #ifdef C70
  469. typedef char CHAR;
  470. /* typedef long LONG; */
  471. #else
  472. #ifdef BSD29
  473. typedef char CHAR;
  474. /* typedef long LONG; */
  475. #else
  476. #ifdef datageneral
  477. #define CHAR unsigned char            /* 3.22 compiler */    
  478. #else
  479. #ifdef CHAR
  480. #undef CHAR
  481. #endif /* CHAR */
  482. typedef unsigned char CHAR;
  483. #endif /* datageneral */
  484. #endif /* BSD29 */
  485. #endif /* C70 */
  486. #endif /* V7 */
  487. #endif /* MINIX */
  488. #endif /* PROVX1 */
  489.  
  490. /*
  491.  Debug and transaction logging is included automatically unless you define
  492.  NODEBUG or NOTLOG.  Do this if you want to save the space and overhead.
  493.  (Note, in version 4F these definitions changed from "{}" to the null string
  494.  to avoid problems with semicolons after braces, as in: "if (x) tlog(this);
  495.  else tlog(that);"
  496. */
  497. #ifndef NODEBUG
  498. #ifndef DEBUG
  499. #define DEBUG
  500. #endif /* DEBUG */
  501. #else
  502. #ifdef DEBUG
  503. #undef DEBUG
  504. #endif /* DEBUG */
  505. #endif /* NODEBUG */
  506.  
  507. #ifndef NOTLOG
  508. #ifndef TLOG
  509. #define TLOG
  510. #endif /* TLOG */
  511. #endif /* NOTLOG */
  512.  
  513. /* debug() macro style selection. */
  514.  
  515. #ifdef MAC
  516. #ifndef IFDEBUG
  517. #define IFDEBUG
  518. #endif /* IFDEBUG */
  519. #endif /* MAC */
  520.  
  521. #ifdef OS2
  522. #ifndef IFDEBUG
  523. #define IFDEBUG
  524. #endif /* IFDEBUG */
  525. #endif /* OS2 */
  526.  
  527. #ifdef OXOS                /* tst is faster than jsr */
  528. #ifndef IFDEBUG
  529. #define IFDEBUG
  530. #endif /* IFDEBUG */
  531. #endif /* OXOS */
  532.  
  533. #ifndef DEBUG
  534. /* Compile all the debug() statements away.  Saves a lot of space and time. */
  535. #define debug(a,b,c,d)
  536. #else
  537. #ifndef CKCMAI
  538. /* Debugging included.  Declare debug log flag in main program only. */
  539. extern int deblog;
  540. #endif /* CKCMAI */
  541. /* Now define the debug() macro. */
  542. #ifdef IFDEBUG
  543. /* Use this form to avoid function calls: */
  544. #define debug(a,b,c,d) if (deblog) dodebug(a,b,(char *)c,(long)d)
  545. #else
  546. /* Use this form to save space: */
  547. #define debug(a,b,c,d) dodebug(a,b,(char *)c,(long)d)
  548. #endif /* MAC */
  549. _PROTOTYP(int dodebug,(int, char *, char *, long));
  550. #endif /* DEBUG */
  551.  
  552. #ifndef TLOG
  553. #define tlog(a,b,c,d)
  554. #else
  555. _PROTOTYP(VOID tlog,(int, char *, char *, long));
  556. #endif /* TLOG */
  557.  
  558. /* Formats for debug() and tlog() */
  559.  
  560. #define F000 0
  561. #define F001 1
  562. #define F010 2
  563. #define F011 3
  564. #define F100 4
  565. #define F101 5
  566. #define F110 6
  567. #define F111 7
  568.  
  569. /* Kermit feature selection */
  570.  
  571. #define CK_SPEED            /* Control-prefix removal */
  572. #ifdef NOCKSPEED
  573. #undef CK_SPEED
  574. #endif /* NOCKSPEED */
  575.  
  576. #ifdef MAC                /* For Macintosh, no escape */
  577. #define NOPUSH                /* to operating system */
  578. #endif /* MAC */
  579.  
  580. #ifdef UNIX
  581. #ifndef NOPARSEN
  582. #define PARSENSE            /* Automatic parity detection */
  583. #endif /* NOPARSEN */
  584. #endif /* UNIX */            /* for Unix */
  585.  
  586. #ifdef VMS                /* ... and VMS */
  587. #ifndef NOPARSEN
  588. #define PARSENSE
  589. #endif /* NOPARSEN */
  590. #ifdef __GNUC__
  591. #define VMSGCC
  592. #endif /* __GNUC__ */
  593. #endif /* VMS */
  594.  
  595. #ifdef MAC                /* and Macintosh */
  596. #ifndef NOPARSEN
  597. #define PARSENSE
  598. #endif /* NOPARSEN */
  599. #endif /* MAC */
  600.  
  601. #ifdef VMS                /* Use dynamic memory allocation */
  602. #ifndef DYNAMIC
  603. #define DYNAMIC                /* in VMS version. */
  604. #endif /* DYNAMIC */
  605. #endif /* VMS */
  606.  
  607. #ifndef CK_LBRK                /* Can send Long BREAK */
  608.  
  609. #ifdef UNIX                /* (everybody but OS-9) */
  610. #define CK_LBRK
  611. #endif /* UNIX */
  612. #ifdef VMS
  613. #define CK_LBRK
  614. #endif /* VMS */
  615. #ifdef datageneral
  616. #define CK_LBRK
  617. #endif /* datageneral */
  618. #ifdef GEMDOS
  619. #define CK_LBRK
  620. #endif /* GEMDOS */
  621. #ifdef OS2
  622. #define CK_LBRK
  623. #endif /* OS2 */
  624. #ifdef AMIGA
  625. #define CK_LBRK
  626. #endif /* AMIGA */
  627.  
  628. #endif /* CK_LBRK */
  629.  
  630. /* Carrier treatment */
  631. /* These are defined here because they are shared by the system dependent */
  632. /* and the system independent modules. */
  633.  
  634. #define  CAR_OFF 0    /* On: heed carrier always, except during DIAL. */
  635. #define  CAR_ON  1      /* Off: ignore carrier always. */
  636. #define  CAR_AUT 2      /* Auto: heed carrier, but only if line is declared */
  637.             /* to be a modem line, and only during CONNECT. */
  638.  
  639. /* Hangup by modem command supported by default */
  640.  
  641. #ifndef NODIAL
  642. #ifndef NOMDMHUP
  643. #ifndef MDMHUP
  644. #define MDMHUP 
  645. #endif /* MDMHUP */
  646. #endif /* NOMDMHUP */
  647. #endif /* NODIAL */
  648.  
  649. /* Types of flow control available */
  650.  
  651. #define CK_XONXOFF            /* Everybody can do this, right? */
  652.  
  653. #ifdef AMIGA                /* Commodore Amiga */
  654. #define CK_RTSCTS            /* has RTS/CTS */
  655. #endif /* AMIGA */
  656.  
  657. #ifdef SUN4S5                /* SunOS in System V environment */
  658. #define CK_RTSCTS
  659. #else                    /* SunOS 4.0/4.1 in BSD environment */
  660. #ifdef SUNOS4                /* SunOS 4.0+later supports RTS/CTS */
  661. #ifdef SUNOS41                /* Easy in 4.1 and later */
  662. #define CK_RTSCTS
  663. #else                    /* Harder in 4.0 */
  664. #ifndef __GNUC__            /* (see tthflow() in ckutio.c) */
  665. #ifndef GNUC
  666. #define CK_RTSCTS            /* Only if not using GNU gcc */
  667. #endif /* __GNUC__ */
  668. #endif /* GNUC */
  669. #endif /* SUNOS41 */
  670. #endif /* SUNOS4 */
  671. #endif /* SUN4S5 */
  672.  
  673. #ifdef BSD44                /* And in 4.4 BSD */
  674. #define CK_RTSCTS
  675. #endif /* BSD44 */
  676.  
  677. #ifdef TERMIOX                /* Sys V R4 <termiox.h> */
  678. #define CK_RTSCTS            /* has RTS/CTS */
  679. #define CK_DTRCD            /* and DTR/CD */
  680. #endif /* TERMIOX */
  681. #ifdef STERMIOX                /* Sys V R4 <sys/termiox.h> */
  682. #define CK_RTSCTS            /* Ditto. */
  683. #define CK_DTRCD
  684. #endif /* STERMIOX */
  685.  
  686. #ifdef OXOS                /* X/OS R2 struct termios */
  687. #define CK_RTSCTS            /* Ditto. */
  688. #define CK_DTRCD
  689. #endif /* OXOS */
  690.  
  691. #ifdef AIXRS                /* RS/6000 with AIX 3.x */
  692. #define CK_RTSCTS            /* Has its own special way... */
  693. #endif /* AIXRS */
  694.  
  695. /*
  696.  Systems where we can expand tilde at the beginning of file or directory names
  697. */
  698. #ifdef POSIX
  699. #ifndef DTILDE
  700. #define DTILDE
  701. #endif /* DTILDE */
  702. #endif /* POSIX */
  703. #ifdef BSD4
  704. #ifndef DTILDE
  705. #define DTILDE
  706. #endif /* DTILDE */
  707. #endif /* BSD4 */
  708. #ifdef ATTSV
  709. #ifndef DTILDE
  710. #define DTILDE
  711. #endif /* DTILDE */
  712. #endif /* ATTSV */
  713. #ifdef OSK
  714. #ifndef DTILDE
  715. #define DTILDE
  716. #endif /* DTILDE */
  717. #endif /* OSK */
  718. #ifdef HPUX                /* I don't know why this is */
  719. #ifndef DTILDE                /* necessary, since -DHPUX */
  720. #define DTILDE                /* automatically defines ATTSV */
  721. #endif /* DTILDE */            /* (see above) ... */
  722. #endif /* HPUX */
  723.  
  724. /*
  725.   This is mainly for the benefit of ckufio.c (UNIX and OS/2 file support).
  726.   Systems that have an atomic rename() function, so we don't have to use
  727.   link() and unlink().
  728. */
  729. #ifdef POSIX
  730. #ifndef RENAME
  731. #define RENAME
  732. #endif /* RENAME */
  733. #endif /* POSIX */
  734.  
  735. #ifdef OS2
  736. #ifndef RENAME
  737. #define RENAME
  738. #endif /* RENAME */
  739. #endif /* OS2 */
  740.  
  741. #ifdef SUNOS41
  742. #ifndef RENAME
  743. #define RENAME
  744. #endif /* RENAME */
  745. #endif /* SUNOS41 */
  746.  
  747. #ifdef SVR4
  748. #ifndef RENAME
  749. #define RENAME
  750. #endif /* RENAME */
  751. #endif /* SVR4 */
  752.  
  753. #ifdef AIXRS
  754. #ifndef RENAME
  755. #define RENAME
  756. #endif /* RENAME */
  757. #endif /* AIXRS */
  758.  
  759. #ifdef BSD44
  760. #ifndef RENAME
  761. #define RENAME
  762. #endif /* RENAME */
  763. #endif /* BSD44 */
  764.  
  765. #ifdef NORENAME                /* Allow for compile-time override */
  766. #ifdef RENAME
  767. #undef RENAME
  768. #endif /* RENAME */
  769. #endif /* NORENAME */
  770.  
  771.  
  772. /* Line delimiter for text files */
  773.  
  774. /*
  775.  If the system uses a single character for text file line delimitation,
  776.  define NLCHAR to the value of that character.  For text files, that
  777.  character will be converted to CRLF upon output, and CRLF will be converted
  778.  to that character on input during text-mode (default) packet operations.
  779. */
  780. #ifdef MAC                              /* Macintosh */
  781. #define NLCHAR 015
  782. #else
  783. #ifdef OSK                /* OS-9/68K */
  784. #define NLCHAR 015
  785. #else                                   /* All Unix-like systems */
  786. #define NLCHAR 012
  787. #endif /* OSK */
  788. #endif /* MAC */
  789.  
  790. /*
  791.  At this point, if there's a system that uses ordinary CRLF line
  792.  delimitation AND the C compiler actually returns both the CR and
  793.  the LF when doing input from a file, then #undef NLCHAR.
  794. */
  795. #ifdef OS2                /* OS/2 */
  796. #undef NLCHAR
  797. #endif /* OS2 */
  798.  
  799. #ifdef GEMDOS                /* Atari ST */
  800. #undef NLCHAR
  801. #endif /* GEMDOS */
  802.  
  803. /*
  804.   VMS file formats are so complicated we need to do all the conversion 
  805.   work in the CKVFIO module, so we tell the rest of C-Kermit not to fiddle
  806.   with the bytes.
  807. */
  808.  
  809. #ifdef vms
  810. #undef NLCHAR
  811. #endif /* vms */
  812.  
  813. /* The device name of a job's controlling terminal */
  814. /* Special for VMS, same for all Unixes (?), not used by Macintosh */
  815.  
  816. #ifdef vms
  817. #define CTTNAM "TT:"
  818. #else
  819. #ifdef datageneral
  820. #define CTTNAM "@output"
  821. #else
  822. #ifdef OSK
  823. extern char myttystr[];
  824. #define CTTNAM myttystr
  825. #else
  826. #ifdef OS2
  827. #define CTTNAM "con"
  828. #else
  829. #ifdef UNIX
  830. #define CTTNAM "/dev/tty"
  831. #else
  832. #ifdef GEMDOS
  833. #define CTTNAM "aux:"
  834. #else /* Anyone else... */
  835. #define CTTNAM "stdout"            /* This is a kludge used by Mac */
  836. #endif /* GEMDOS */
  837. #endif /* UNIX */
  838. #endif /* OS2 */
  839. #endif /* OSK */
  840. #endif /* datageneral */
  841. #endif /* vms */
  842.  
  843. #ifdef SUNS4S5
  844. #define tolower _tolower
  845. #define toupper _toupper
  846. #endif /* SUNS4S5 */
  847.  
  848. /* Error number */
  849.  
  850. #ifdef _CRAY                
  851. #ifdef _CRAYCOM                /* Cray Computer Corp. */
  852. extern int errno;
  853. #else /* _CRAYCOM */
  854. #include <errno.h>            /* Cray Research UNICOS defines */
  855.                     /* errno as a function. */
  856. #endif /* _CRAYCOM */            /* OK for UNICOS 6.1 and 7.0. */
  857. #else /* _CRAY */
  858. #ifndef VMS
  859. #ifndef OS2
  860. /*
  861.   The following declaration causes problems for VMS and OS/2, in which
  862.   errno is an "extern volatile int noshare"...
  863. */
  864. extern int errno;            /* Needed by most modules. */
  865. #endif /* OS2 */
  866. #endif /* VMS */
  867. #endif /* _CRAY */
  868.  
  869. /* File System Defaults */
  870.  
  871. #ifdef VMS
  872. #define DBLKSIZ 512
  873. #define DLRECL 512
  874. #else
  875. #define DBLKSIZ 0
  876. #define DLRECL 0
  877. #endif
  878.  
  879. /* Program return codes for DECUS C and UNIX (VMS uses UNIX codes) */
  880.  
  881. #ifdef decus
  882. #define GOOD_EXIT   IO_NORMAL
  883. #define BAD_EXIT    IO_ERROR
  884. #else
  885. #define GOOD_EXIT   0
  886. #define BAD_EXIT    1
  887. #endif /* decus */
  888.  
  889. /* Special hack for Fortune, which doesn't have <sys/file.h>... */
  890.  
  891. #ifdef FT18
  892. #define FREAD 0x01
  893. #define FWRITE 0x10
  894. #endif /* FT18 */
  895.  
  896. /* Special hack for OS-9/68k */
  897. #ifdef OSK
  898. #define SIGALRM 30            /* May always cancel I/O */
  899. #define SIGARB    1234            /* Arbitrary for I/O */
  900. SIGTYP (*signal())();
  901. #endif /* OSK */
  902.  
  903. #ifdef OS2
  904. #ifdef putchar                  /* MSC 5.1 simply uses a macro which causes */
  905. #undef putchar                  /* no problems. */
  906. #endif /* putchar */
  907. #endif /* OS2 */
  908.  
  909. #ifdef MINIX
  910. #ifdef putchar
  911. #undef putchar
  912. #endif /* putchar */
  913. #define putchar(c) {putc(c,stdout);fflush(stdout);}
  914. #endif /* MINIX */
  915.  
  916. #ifdef datageneral            /* Data General AOS/VS */
  917. #ifdef putchar
  918. #undef putchar
  919. #endif /* putchar */
  920. #define putchar(c) conoc(c)
  921. #endif /* datageneral */
  922.  
  923. /* Escape/quote character used by the command parser */
  924.  
  925. #define CMDQ '\\'
  926.  
  927. /* Symbols for RS-232 modem signals */
  928.  
  929. #define KM_FG    1            /* Frame ground */
  930. #define KM_TXD   2            /* Transmit */
  931. #define KM_RXD   3            /* Receive */
  932. #define KM_RTS   4            /* Request to Send */
  933. #define KM_CTS   5            /* Clear to Send */
  934. #define KM_DSR   6            /* Data Set Ready */
  935. #define KM_SG    7            /* Signal ground */
  936. #define KM_DCD   8            /* Carrier Detect */
  937. #define KM_DTR  20            /* Data Terminal Ready */
  938. #define KM_RI   22            /* Ring Indication */
  939.  
  940. /* Bit mask values for modem signals */
  941.  
  942. #define BM_CTS   0001            /* Clear to send       (From DCE) */
  943. #define BM_DSR   0002            /* Dataset ready       (From DCE) */
  944. #define BM_DCD   0004            /* Carrier             (From DCE) */
  945. #define BM_RNG   0010            /* Ring Indicator      (From DCE) */
  946. #define BM_DTR   0020            /* Data Terminal Ready (From DTE) */
  947. #define BM_RTS   0040            /* Request to Send     (From DTE) */
  948.  
  949. /* Codes for full duplex flow control */
  950.  
  951. #define FLO_NONE 0            /* None */
  952. #define FLO_XONX 1            /* Xon/Xoff (soft) */
  953. #define FLO_RTSC 2            /* RTS/CTS (hard) */
  954. #define FLO_DTRC 3            /* DTR/CD (hard) */
  955. #define FLO_ETXA 4            /* ETX/ACK (soft) */
  956. #define FLO_STRG 5            /* String-based (soft) */
  957. #define FLO_DIAL 6            /* DIALing kludge */
  958. #define FLO_DIAX 7            /* Cancel dialing kludge */
  959. #define FLO_DTRT 8            /* DTR/CTS (hard) */
  960. #define FLO_KEEP 9            /* Keep, i.e. don't touch or change */
  961.  
  962. /* And finally... */
  963.  
  964. #ifdef COMMENT                /* Make sure this is NOT defined! */
  965. #undef COMMENT
  966. #endif /* COMMENT */
  967.  
  968. /* Structure definitions for Kermit file attributes */
  969. /* All strings come as pointer and length combinations */
  970. /* Empty string (or for numeric variables, -1) = unused attribute. */
  971.  
  972. struct zstr {             /* string format */
  973.     int len;              /* length */
  974.     char *val;            /* value */
  975. };
  976. struct zattr {            /* Kermit File Attribute structure */
  977.     long lengthk;         /* (!) file length in K */
  978.     struct zstr type;     /* (") file type (text or binary) */
  979.     struct zstr date;     /* (#) file creation date yyyymmdd[ hh:mm[:ss]] */
  980.     struct zstr creator;  /* ($) file creator id */
  981.     struct zstr account;  /* (%) file account */
  982.     struct zstr area;     /* (&) area (e.g. directory) for file */
  983.     struct zstr passwd;   /* (') password for area */
  984.     long blksize;         /* (() file blocksize */
  985.     struct zstr access;   /* ()) file access: new, supersede, append, warn */
  986.     struct zstr encoding; /* (*) encoding (transfer syntax) */
  987.     struct zstr disp;     /* (+) disposition (mail, message, print, etc) */
  988.     struct zstr lprotect; /* (,) protection (local syntax) */
  989.     struct zstr gprotect; /* (-) protection (generic syntax) */
  990.     struct zstr systemid; /* (.) ID for system of origin */
  991.     struct zstr recfm;    /* (/) record format */
  992.     struct zstr sysparam; /* (0) system-dependent parameter string */
  993.     long length;          /* (1) exact length on system of origin */
  994.     struct zstr charset;  /* (2) transfer syntax character set */
  995.     struct zstr reply;    /* This goes last, used for attribute reply */
  996. };
  997.  
  998. /* Kermit file information structure */
  999.  
  1000. struct filinfo {
  1001.   int bs;                /* Blocksize */
  1002.   int cs;                /* Character set */
  1003.   long rl;                /* Record length */
  1004.   int org;                /* Organization */
  1005.   int fmt;                /* Record format */
  1006.   int cc;                /* Carriage control */
  1007.   int typ;                /* Type (text/binary) */
  1008.   int dsp;                /* Disposition */
  1009.   char *os_specific;            /* OS-specific attributes */
  1010.   unsigned int lblopts;            /* LABELED FILE options bitmask */
  1011. };
  1012.  
  1013. /* VMS values for LABELED FILE options bitmask */
  1014.  
  1015. #ifdef VMS
  1016. #define LBL_NAM  1            /* Ignore incoming name if set */
  1017. #define LBL_PTH  2            /* Use complete path if set */
  1018. #define LBL_ACL  4            /* Preserve ACLs if set */
  1019. #define LBL_BCK  8            /* Preserve backup date if set */
  1020. #define LBL_OWN 16            /* Preserve ownership if set */
  1021. #endif /* VMS */
  1022.  
  1023. /*
  1024.   Data types.  First the header file for data types so we can pick up the
  1025.   types used for pids, uids, and gids.  Override this section by putting
  1026.   -DCKTYP_H=xxx on the command line to specify the header file where your
  1027.   system defines these types.
  1028. */
  1029. #ifdef __ALPHA
  1030. #ifdef MULTINET
  1031. #define CK_TGV_AXP
  1032. #endif /* MULTINET */
  1033. #endif /* __ALPHA */
  1034.  
  1035. #ifdef CK_TGV_AXP            /* Alpha AXP, VMS, MultiNet */
  1036. #ifndef __TYPES_LOADED
  1037. #define __TYPES_LOADED            /* Work around bug in .h files */
  1038. #endif /* __TYPES_LOADED */
  1039. #include <sys/types.h>
  1040. #else                    /* !CK_TGV_AXP */
  1041. #ifdef OSK                /* OS-9 */
  1042. #include <types.h>
  1043. #else                    /* General case, not OS-9 */
  1044. #ifndef CKTYP_H
  1045. #ifndef VMS
  1046. #ifndef MAC
  1047. #ifndef AMIGA
  1048. #define CKTYP_H <sys/types.h>
  1049. #endif /* AMIGA */
  1050. #endif /* MAC */
  1051. #endif /* VMS */
  1052. #endif /* CKTYP_H */
  1053.  
  1054. #ifdef GEMDOS
  1055. #undef CKTYP_H
  1056. #include <types.h>
  1057. #endif /* GEMDOS */
  1058.  
  1059. #ifdef OS2
  1060. #undef CKTYP_H
  1061. #include <sys/types.h>
  1062. #endif /* OS2 */
  1063.  
  1064. #ifdef CKTYP_H                /* Include it. */
  1065. #ifdef COHERENT                /* Except for COHERENT */
  1066. #include <sys/types.h>
  1067. #else
  1068. #ifdef datageneral
  1069. #include <sys/types.h>            /* Compiler didn't like other */
  1070. #else
  1071. #include CKTYP_H
  1072. #endif /* datageneral */
  1073. #endif /* COHERENT */
  1074. #endif /* CKTYP_H */
  1075.  
  1076. #endif /* OSK */
  1077. #endif /* CK_TGV_AXP */            /* End of types.h section */
  1078.  
  1079. /*
  1080.   Data type for pids.  If your system uses a different type, put something
  1081.   like -DPID_T=pid_t on command line, or override here.
  1082. */
  1083. #ifndef PID_T
  1084. #define PID_T int
  1085. #endif /* PID_T */
  1086. /*
  1087.   Data types for uids and gids.  Same deal as for pids.
  1088.   Wouldn't be nice if there was a preprocessor test to find out if a
  1089.   typedef existed?
  1090. */
  1091. #ifdef VMS
  1092. /* Not used in VMS so who cares */
  1093. #define UID_T int
  1094. #define GID_T int
  1095. #endif /* VMS */
  1096.  
  1097. #ifdef POSIX
  1098. /* Or would it be better (or worse?) to use _POSIX_SOURCE here? */
  1099. #ifndef UID_T
  1100. #define UID_T uid_t
  1101. #endif /* UID_T */
  1102. #ifndef GID_T
  1103. #define GID_T gid_t
  1104. #endif /* GID_T */
  1105. #else /* Not POSIX */
  1106. #ifdef SVR4
  1107. /* SVR4 and later have uid_t and gid_t. */
  1108. /* SVR3 and earlier use int, or unsigned short, or.... */
  1109. #ifndef UID_T
  1110. #define UID_T uid_t
  1111. #endif /* UID_T */
  1112. #ifndef GID_T
  1113. #define GID_T gid_t
  1114. #endif /* GID_T */
  1115. #else /* Not SVR4 */
  1116. #ifdef BSD43
  1117. #ifndef UID_T
  1118. #define UID_T uid_t
  1119. #endif /* UID_T */
  1120. #ifndef GID_T
  1121. #define GID_T gid_t
  1122. #endif /* GID_T */
  1123. #else /* Not BSD43 */
  1124. /* Default these to int for older UNIX versions */
  1125. #ifndef UID_T
  1126. #define UID_T int
  1127. #endif /* UID_T */
  1128. #ifndef GID_T
  1129. #define GID_T int
  1130. #endif /* GID_T */
  1131. #endif /* BSD43 */
  1132. #endif /* SVR4  */
  1133. #endif /* POSIX */
  1134.  
  1135. /* 
  1136.   getpwuid() arg type, which is not necessarily the same as UID_T,
  1137.   e.g. in SCO UNIX SVR3, it's int.
  1138. */
  1139. #ifndef PWID_T
  1140. #define PWID_T UID_T
  1141. #endif /* PWID_T */
  1142.  
  1143. #ifdef NEXT                /* Argument for wait() */
  1144. #include <sys/wait.h>
  1145. typedef union wait WAIT_T;
  1146. #else
  1147. #ifdef POSIX
  1148. #include <sys/wait.h>
  1149. #ifndef WAIT_T
  1150. #ifdef QNX
  1151. typedef int WAIT_T;
  1152. #else
  1153. #define WAIT_T pid_t
  1154. #endif /* QNX */
  1155. #endif /* WAIT_T */
  1156. #else
  1157. typedef int WAIT_T;
  1158. #endif /* POSIX */
  1159. #endif /* NEXT */
  1160.  
  1161. /* Forward declarations of system-dependent functions callable from all */
  1162. /* C-Kermit modules. */
  1163.  
  1164. /* File-related functions from system-dependent file i/o module */
  1165.  
  1166. _PROTOTYP( int zkself, (void) );
  1167. _PROTOTYP( int zopeni, (int, char *) );
  1168. _PROTOTYP( int zopeno, (int, char *, struct zattr *, struct filinfo *) );
  1169. _PROTOTYP( int zclose, (int) );
  1170. #ifndef MAC
  1171. _PROTOTYP( int zchin, (int, int *) );
  1172. #endif /* MAC */
  1173. _PROTOTYP( int zsinl, (int, char *, int) );
  1174. _PROTOTYP( int zinfill, (void) );
  1175. _PROTOTYP( int zsout, (int, char*) );
  1176. _PROTOTYP( int zsoutl, (int, char*) );
  1177. _PROTOTYP( int zsoutx, (int, char*, int) );
  1178. _PROTOTYP( int zchout, (int, char) );
  1179. _PROTOTYP( int zoutdump, (void) );
  1180. _PROTOTYP( int zsyscmd, (char *) );
  1181. _PROTOTYP( int zshcmd, (char *) );
  1182. _PROTOTYP( int chkfn, (int) );
  1183. _PROTOTYP( long zchki, (char *) );
  1184. _PROTOTYP( int iswild, (char *) );
  1185. _PROTOTYP( int zchko, (char *) );
  1186. _PROTOTYP( int zdelet, (char *) );
  1187. _PROTOTYP( VOID zrtol, (char *,char *) );
  1188. _PROTOTYP( VOID zltor, (char *,char *) );
  1189. _PROTOTYP( VOID zstrip, (char *,char **) );
  1190. _PROTOTYP( int zchdir, (char *) );
  1191. _PROTOTYP( char * zhome, (void) );
  1192. _PROTOTYP( char * zgtdir, (void) );
  1193. _PROTOTYP( int zxcmd, (int, char *) );
  1194. #ifndef MAC
  1195. _PROTOTYP( int zclosf, (int) );
  1196. #endif /* MAC */
  1197. _PROTOTYP( int zxpand, (char *) );
  1198. _PROTOTYP( int znext, (char *) );
  1199. _PROTOTYP( int zchkspa, (char *, long) );
  1200. _PROTOTYP( VOID znewn, (char *, char **) );
  1201. _PROTOTYP( int zrename, (char *, char *) );
  1202. _PROTOTYP( int zsattr, (struct zattr *) );
  1203. _PROTOTYP( int zfree, (char *) );
  1204. _PROTOTYP( char * zfcdat, (char *) );
  1205. _PROTOTYP( int zstime, (char *, struct zattr *, int) );
  1206. _PROTOTYP( int zmail, (char *, char *) ); 
  1207. _PROTOTYP( int zprint, (char *, char *) ); 
  1208. _PROTOTYP( char * tilde_expand, (char *) ); 
  1209.  
  1210. /* Functions from system-dependent terminal i/o module */
  1211.  
  1212. _PROTOTYP( int ttopen, (char *, int *, int, int) );  /* tty functions */
  1213. #ifndef MAC
  1214. _PROTOTYP( int ttclos, (int) );
  1215. #endif /* MAC */
  1216. _PROTOTYP( int tthang, (void) );
  1217. _PROTOTYP( int ttres, (void) );
  1218. _PROTOTYP( int ttpkt, (long, int, int) );
  1219. #ifndef MAC
  1220. _PROTOTYP( int ttvt, (long, int) );
  1221. #endif /* MAC */
  1222. _PROTOTYP( int ttsspd, (int) );
  1223. _PROTOTYP( long ttgspd, (void) );
  1224. _PROTOTYP( int ttflui, (void) );
  1225. _PROTOTYP( int ttfluo, (void) );
  1226. _PROTOTYP( int ttchk, (void) );
  1227. _PROTOTYP( int ttxin, (int, CHAR *) );
  1228. _PROTOTYP( int ttol, (CHAR *, int) );
  1229. _PROTOTYP( int ttoc, (char) );
  1230. _PROTOTYP( int ttinc, (int) );
  1231. _PROTOTYP( int ttscarr, (int) );
  1232. _PROTOTYP( int ttgmdm, (void) );
  1233. _PROTOTYP( int ttsndb, (void) );
  1234. _PROTOTYP( int ttsndlb, (void) );
  1235. #ifdef PARSENSE
  1236. #ifdef UNIX
  1237. _PROTOTYP( int ttinl, (CHAR *, int, int, CHAR, CHAR, int) );
  1238. #else
  1239. #ifdef VMS
  1240. _PROTOTYP( int ttinl, (CHAR *, int, int, CHAR, CHAR, int) );
  1241. #else
  1242. _PROTOTYP( int ttinl, (CHAR *, int, int, CHAR, CHAR) );
  1243. #endif /* VMS */
  1244. #endif /* UNIX */
  1245. #else
  1246. _PROTOTYP( int ttinl, (CHAR *, int, int, CHAR) );
  1247. #endif /* PARSENSE */
  1248.  
  1249. /* Console functions */
  1250.  
  1251. _PROTOTYP( int congm, (void) );
  1252. #ifdef COMMENT
  1253. _PROTOTYP( VOID conint, (SIGTYP (*)(int, int), SIGTYP (*)(int, int)) );
  1254. #else
  1255. _PROTOTYP( VOID conint, (SIGTYP (*)(int), SIGTYP (*)(int)) );
  1256. #endif
  1257. _PROTOTYP( VOID connoi, (void) );
  1258. _PROTOTYP( int concb, (char) );
  1259. _PROTOTYP( int conbin, (char) );
  1260. _PROTOTYP( int conres, (void) );
  1261. _PROTOTYP( int conoc, (char) );
  1262. _PROTOTYP( int conxo, (int, char *) );
  1263. _PROTOTYP( int conol, (char *) );
  1264. _PROTOTYP( int conola, (char *[]) );
  1265. _PROTOTYP( int conoll, (char *) );
  1266. _PROTOTYP( int conchk, (void) );
  1267. _PROTOTYP( int coninc, (int) );
  1268. _PROTOTYP( int psuspend, (int) );
  1269. _PROTOTYP( int priv_ini, (void) );
  1270. _PROTOTYP( int priv_on, (void) );
  1271. _PROTOTYP( int priv_off, (void) );
  1272. _PROTOTYP( int priv_can, (void) );
  1273. _PROTOTYP( int priv_chk, (void) );
  1274. _PROTOTYP( int priv_opn, (char *, int) );
  1275.  
  1276. _PROTOTYP( int sysinit, (void) );    /* Misc Kermit functions */
  1277. _PROTOTYP( int syscleanup, (void) );
  1278. _PROTOTYP( int msleep, (int) );
  1279. _PROTOTYP( VOID rtimer, (void) );
  1280. _PROTOTYP( int gtimer, (void) );
  1281. _PROTOTYP( VOID ttimoff, (void) );
  1282. _PROTOTYP( VOID ztime, (char **) );
  1283. _PROTOTYP( int parchk, (CHAR *, CHAR, int) );
  1284. _PROTOTYP( VOID doexit, (int, int) );
  1285. _PROTOTYP( int askmore, (void) );
  1286. _PROTOTYP( VOID fatal, (char *) );
  1287.  
  1288. /* Key mapping support */
  1289.  
  1290. #ifdef NOICP
  1291. #ifndef NOSETKEY
  1292. #define NOSETKEY
  1293. #endif /* NOSETKEY */
  1294. #endif /* NOICP */
  1295.  
  1296. _PROTOTYP( int congks, (int) );
  1297. #ifndef NOSETKEY
  1298. #ifdef OS2
  1299. #define KMSIZE 768
  1300. typedef int KEY;
  1301. typedef CHAR *MACRO;
  1302. extern int wideresult;
  1303. _PROTOTYP( VOID keymapinit, (void) );
  1304. #else /* Not OS2 */
  1305. /*
  1306.   Catch-all for systems where we don't know how to read keyboard scan
  1307.   codes > 255.  Note: CHAR (i.e. unsigned char) is very important here.
  1308. */
  1309. #define KMSIZE 256
  1310. typedef CHAR KEY;
  1311. typedef CHAR * MACRO;
  1312. #define congks coninc
  1313. #endif /* OS2 */
  1314. #endif /* NOSETKEY */
  1315.  
  1316. /*
  1317.   Function prototypes for system and library functions.
  1318. */
  1319. #ifdef _POSIX_SOURCE
  1320. #ifndef VMS
  1321. #ifndef MAC
  1322. #define CK_ANSILIBS
  1323. #endif /* MAC */
  1324. #endif /* VMS */
  1325. #endif /* _POSIX_SOURCE */
  1326.  
  1327. #ifdef NEXT
  1328. #define CK_ANSILIBS
  1329. #endif /* NEXT */
  1330.  
  1331. #ifdef SVR4
  1332. #define CK_ANSILIBS
  1333. #endif /* SVR4 */
  1334.  
  1335. #ifdef OS2
  1336. #define KANJI
  1337. #define CK_ANSILIBS
  1338. #define MYCURSES
  1339. #define CK_RTSCTS
  1340. #ifdef __IBMC__
  1341. #define S_IFMT 0xF000
  1342. #define timezone _timezone
  1343. #endif /* __IBMC__ */
  1344. #include <io.h>
  1345. #ifdef __EMX__
  1346. #ifndef __32BIT__
  1347. #define __32BIT__
  1348. #endif /* __32BIT__ */
  1349. #include <sys/timeb.h>
  1350. #else
  1351. #include <direct.h>
  1352. #define SIGALRM SIGUSR1
  1353. _PROTOTYP( unsigned alarm, (unsigned) );
  1354. _PROTOTYP( unsigned sleep, (unsigned) );
  1355. #endif /* __EMX__ */
  1356. _PROTOTYP( long zdskspace, (int) );
  1357. _PROTOTYP( int zchdsk, (int) );
  1358. _PROTOTYP( int conincraw, (int) );
  1359. _PROTOTYP( int ttiscom, (int f) );
  1360. _PROTOTYP( int IsFileNameValid, (char *) );
  1361. _PROTOTYP( void ChangeNameForFAT, (char *) );
  1362. _PROTOTYP( char *GetLoadPath, (void) );
  1363. #endif /* OS2 */
  1364.  
  1365. #ifdef MYCURSES                /* MYCURSES implies CK_CURSES */
  1366. #ifndef CK_CURSES
  1367. #define CK_CURSES
  1368. #endif /* CK_CURSES */
  1369. #endif /* MYCURSES */
  1370.  
  1371. #ifdef CK_ANSILIBS
  1372. /*
  1373.   String library functions.
  1374.   For ANSI C, get prototypes from <string.h>.
  1375.   Otherwise, skip the prototypes.
  1376. */
  1377. #include <string.h>
  1378.  
  1379. /*
  1380.   Prototypes for other commonly used library functions, such as
  1381.   malloc, free, getenv, atol, atoi, and exit.  Otherwise, no prototypes.
  1382. */
  1383. #include <stdlib.h>
  1384. #ifdef DIAB /* DIAB DS90 */
  1385. /* #include <commonC.h>  */
  1386. #include <sys/wait.h>
  1387. #ifdef COMMENT
  1388. extern void exit(int status);
  1389. extern void _exit(int status);
  1390. extern int uname(struct utsname *name);
  1391. #endif /* COMMENT */
  1392. extern int chmod(char *path, int mode);
  1393. extern int ioctl(int fildes, int request, ...);
  1394. extern int rdchk(int ttyfd);
  1395. extern int nap(int m);
  1396. #ifdef COMMENT
  1397. extern int getppid(void);
  1398. #endif /* COMMENT */
  1399. extern int _filbuf(FILE *stream);
  1400. extern int _flsbuf(char c,FILE *stream);
  1401. #endif /* DIAB */
  1402.  
  1403. /*
  1404.   Prototypes for UNIX functions like access, alarm, chdir, sleep, fork,
  1405.   and pause.  Otherwise, no prototypes.
  1406. */
  1407. #ifdef NEXT
  1408. #include <libc.h>
  1409. #else
  1410. #ifndef AMIGA
  1411. #ifndef OS2
  1412. #include <unistd.h>
  1413. #endif /* OS2 */
  1414. #endif /* AMIGA */
  1415. #endif /* NEXT */
  1416.  
  1417. #else /* Not ANSI libs... */
  1418.  
  1419. #ifdef MAC
  1420. #include <String.h>
  1421. #include <StdLib.h>
  1422. #endif /* MAC */
  1423.  
  1424. #ifdef SUNOS41
  1425. #include <unistd.h>
  1426. #include <stdlib.h>
  1427. #else
  1428. /*
  1429.   It is essential that these are declared correctly!
  1430.   Which is not always easy.  Take malloc() for instance ...
  1431. */
  1432. #ifdef PYRAMID
  1433. #ifdef SVR4
  1434. #ifdef __STDC__
  1435. #define SIZE_T_MALLOC
  1436. #endif /* __STDC__ */
  1437. #endif /* SVR4 */
  1438. #endif /* PYRAMID */
  1439. /*
  1440.   Maybe some other environments need the same treatment for malloc.
  1441.   If so, define SIZE_T_MALLOC for them here or in compiler CFLAGS.
  1442. */
  1443. #ifdef SIZE_T_MALLOC
  1444. _PROTOTYP( void * malloc, (size_t) );
  1445. #else
  1446. _PROTOTYP( char * malloc, (unsigned int) );
  1447. #endif /* SIZE_T_MALLOC */
  1448.  
  1449. _PROTOTYP( char * getenv, (char *) );
  1450. _PROTOTYP( long atol, (char *) );
  1451. #endif /* SUNOS4 */
  1452. #endif /* CK_ANSILIBS */
  1453.  
  1454. #ifndef NULL                /* In case NULL is still not defined */
  1455. #define NULL 0L
  1456. /* or #define NULL 0 */
  1457. /* or #define NULL ((char *) 0) */
  1458. /* or #define NULL ((void *) 0) */
  1459. #endif /* NULL */
  1460.  
  1461. /* Funny names for library functions department... */
  1462.  
  1463. #ifdef ZILOG
  1464. #define setjmp setret
  1465. #define longjmp longret
  1466. #define jmp_buf ret_buf
  1467. #define getcwd curdir
  1468. #endif /* ZILOG */
  1469.  
  1470. #endif /* CKCDEB_H */
  1471.  
  1472. /* End of ckcdeb.h */
  1473.